import sys

from celery import Celery
import django
import os
from pathlib import Path

# 添加Django项目的路径到sys.path中
current_path = Path(__file__).resolve().parent.parent

sys.path.insert(0,os.path.join(current_path, 'yv_backend'))

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'yv_backend.config.dev')

#创建celery实例
celery_app = Celery('yv_backend')

#加载celery配置

celery_app.config_from_object('celery_tasks.config')


#注册celery 任务
celery_app.autodiscover_tasks(['celery_tasks.send_email','celery_tasks.send_dingding','celery_tasks.send_sms'])